Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly sample all properties from imported particle media #228

Merged
merged 2 commits into from
Dec 10, 2024

Conversation

petercamps
Copy link
Contributor

Motivation
For an imported medium described by smoothed particles, when calculating the medium property values in each spatial grid cell during setup, medium properties other than the medium density were taken from the particle nearest the sample location, rather than interpolating over all overlapping particles. Moreover, in rare cases, the code would use a particle close to the sample location but not the nearest particle.

Description
With this new version, medium properties are sampled from an imported particle medium as follows:

  • density is properly interpolated over all overlapping particles, as before.
  • metallicity, temperature, bulk velocity, and magnetic field are now also properly interpolated over all overlapping particles using density-weighted averaging.
  • any additional parameters requested by a material mix or used for selecting a variable material mix are taken from the particle with the highest mass density at the sample location; this is because it is unknown a priori if and how these parameters should be averaged for interpolation.

Tests
All functional tests work. Those affected by the change were adjusted.

@petercamps petercamps merged commit 8f6f82e into SKIRT:master Dec 10, 2024
5 checks passed
@petercamps petercamps deleted the nearest branch December 10, 2024 14:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant